package com.dream.banana.dubbo.filter.pointcut;

import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentSkipListSet;

/**
 * 躲了一辈子雨,与会不会很难过
 * <p>
 * Created by zhumenglong on 2017/5/28.
 */
public abstract class AbstractPointcut {
    protected Set<String> methodPrefixes = new ConcurrentSkipListSet();

    public Set<String> getMethodPrefixes() {
        return Collections.unmodifiableSet(this.methodPrefixes);
    }

    protected abstract void setMethodPrefixes(Set<String> arg0);

    public boolean isTargetMethod(String methodName) {
        return this.methodPrefixes.stream().filter((element) -> {
            return element.equalsIgnoreCase(methodName);
        }).findAny().isPresent();
    }
}
